﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;

namespace JumpNFight.Simulation
{
    /// <summary>
    /// Represents a layer for a tile map
    /// </summary>
    public class TileMapLayer
    {
        /// <summary>
        /// Is the layer visible
        /// </summary>
        public bool IsVisible;
        /// <summary>
        /// Layer name (mostly for debug purposes)
        /// </summary>
        public string Name;

        /// <summary>
        /// Layer height (in tiles unit)
        /// </summary>
        public int Width;

        /// <summary>
        /// Layer width (in tiles unit)
        /// </summary>
        public int Height;

        /// <summary>
        /// Set of tiles
        /// </summary>
        /// <remarks>
        /// Key is tile id in image space, value is tileid in tileset space
        /// </remarks>
        public List<KeyValuePair<int,int>> Tiles = new List<KeyValuePair<int,int>>();

        public TileMapLayer(ContentReader input)
        {
            Name = input.ReadString();
            Width = input.ReadInt32();
            Height = input.ReadInt32();
            IsVisible = input.ReadBoolean();
            Tiles = input.ReadObject<List<KeyValuePair<int, int>>>(new IntIntPairListReader());
        }
    }
}
